class ButtonGroup extends eui.Component implements eui.UIComponent {

    public constructor(robot3) {
        super();
        this.robot3 = robot3;
    }

    public robot3:Robot3;
    public leftBtn:eui.Button;
    public topBtn:eui.Button;
    public rightBtn:eui.Button;

    protected childrenCreated():void {
        this.leftBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.robotLeftBegin, this);
        this.leftBtn.addEventListener(egret.TouchEvent.TOUCH_END, this.robotLeftEnd, this);
        this.topBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touchTopBtn, this);
        this.topBtn.addEventListener(egret.TouchEvent.TOUCH_END, this.touchTopBtn, this);
        this.rightBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.robotRightBegin, this);
        this.rightBtn.addEventListener(egret.TouchEvent.TOUCH_END, this.robotRightEnd, this);
    }

    public robotLeftBegin() {
        this.robot3.moveToLeft();
    }
    public robotLeftEnd() {
        this.robot3.stand();
    }
    public robotRightBegin() {
        this.robot3.moveToRight();
    }
    public robotRightEnd() {
        this.robot3.stand();
    }

    public touchTopBtn(e:egret.TouchEvent) {
        if( e.type === egret.TouchEvent.TOUCH_BEGIN ) {
             this.robot3.jump();
        }
    }
}